package com.pc.web.cart;

import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.pc.web.goods.GoodsBeans;

@Repository
public class CartDao {
	@Autowired
	private SqlSession sql;

	// 장바구니 담기
	public int insert(CartBeans beans) {

		return sql.insert("cart.insert", beans);
	}

	//상품정보 담기
	public GoodsBeans getGoodsInfo(CartBeans beans) {
		return (GoodsBeans)sql.selectOne("cart.getGoodsInfo", beans);
	}

	// 장바구니 목록 출력
	public List<CartBeans> List(CartBeans beans) {
		return sql.selectList("cart.list", beans);
	}

	// 장바구니 상품 수량, 합계 수정
	public int update(CartBeans beans) {
		return sql.update("cart.update", beans);
	}

	// 장바구니 상품번호로 삭제
	public int delete(CartBeans beans) {
		return sql.delete("cart.delete", beans);
	}
}
